home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 November / CPNL0711.ISO / boekhoud / finan / BADGER finance v1.0 beta 2.exe / xampplite / phpMyAdmin / pdf_pages.php < prev    next >
PHP Script  |  2006-01-17  |  26KB  |  537 lines

  1. <?php
  2. /* $Id: pdf_pages.php,v 2.24 2006/01/17 17:02:29 cybot_tm Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5. /**
  6.  * Gets some core libraries
  7.  */
  8. require_once('./libraries/common.lib.php');
  9. require_once('./libraries/db_details_common.inc.php');
  10.  
  11.  
  12. /**
  13.  * Settings for relation stuff
  14.  */
  15. require_once('./libraries/relation.lib.php');
  16. $cfgRelation = PMA_getRelationsParam();
  17.  
  18. // This is to avoid "Command out of sync" errors. Before switching this to
  19. // a value of 0 (for MYSQLI_USE_RESULT), please check the logic
  20. // to free results wherever needed.
  21. $query_default_option = PMA_DBI_QUERY_STORE;
  22.  
  23. /**
  24.  * Now in ./libraries/relation.lib.php we check for all tables
  25.  * that we need, but if we don't find them we are quiet about it
  26.  * so people can work without.
  27.  * This page is absolutely useless if you didn't set up your tables
  28.  * correctly, so it is a good place to see which tables we can and
  29.  * complain ;-)
  30.  */
  31. if (!$cfgRelation['relwork']) {
  32.     echo sprintf($strNotSet, 'relation', 'config.inc.php') . '<br />' . "\n"
  33.          . '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
  34.     require_once('./libraries/footer.inc.php');
  35. }
  36.  
  37. if (!$cfgRelation['displaywork']) {
  38.     echo sprintf($strNotSet, 'table_info', 'config.inc.php') . '<br />' . "\n"
  39.          . '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
  40.     require_once('./libraries/footer.inc.php');
  41. }
  42.  
  43. if (!isset($cfgRelation['table_coords'])){
  44.     echo sprintf($strNotSet, 'table_coords', 'config.inc.php') . '<br />' . "\n"
  45.          . '<a href="./Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>' . "\n";
  46.     exit();
  47. }
  48. if (!isset($cfgRelation['pdf_pages'])) {
  49.     echo sprintf($strNotSet, 'pdf_page', 'config.inc.php') . '<br />' . "\n"
  50.          . '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
  51.     exit();
  52. }
  53.  
  54. if ($cfgRelation['pdfwork']) {
  55.     // Now is the time to work on all changes
  56.     if (isset($do)) {
  57.         switch ($do) {
  58.             case 'choosepage':
  59.                 if ($action_choose=="1") {
  60.                     $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
  61.                               .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  62.                               .   ' AND   pdf_page_number = ' . $chpage;
  63.                     PMA_query_as_cu($ch_query, FALSE, $query_default_option);
  64.  
  65.                     $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
  66.                               .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  67.                               .   ' AND   page_nr = ' . $chpage;
  68.                     PMA_query_as_cu($ch_query, FALSE, $query_default_option);
  69.  
  70.                     unset($chpage);
  71.                 }
  72.                 break;
  73.             case 'createpage':
  74.                 if (!isset($newpage) || $newpage == '') {
  75.                     $newpage = $strNoDescription;
  76.                 }
  77.                 $ins_query   = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
  78.                              . ' (db_name, page_descr)'
  79.                              . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
  80.                 PMA_query_as_cu($ins_query, FALSE, $query_default_option);
  81.  
  82.                 // A u t o m a t i c    l a y o u t
  83.                 //
  84.                 // TODO: support InnoDB
  85.  
  86.                 if (isset($autolayout)) {
  87.                     // save the page number
  88.                     $pdf_page_number = PMA_DBI_insert_id((isset($controllink)?$controllink:''));
  89.  
  90.                     // get the tables that have relations, by descending
  91.                     // number of links
  92.                     $master_tables = 'SELECT COUNT(master_table), master_table'
  93.                                 . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
  94.                                 . ' WHERE master_db = \'' . $db . '\''
  95.                                 . ' GROUP BY master_table'
  96.                                 . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
  97.                     $master_tables_rs = PMA_query_as_cu($master_tables, FALSE, $query_default_option);
  98.                     if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
  99.                         // first put all the master tables at beginning
  100.                         // of the list, so they are near the center of
  101.                         // the schema
  102.                         while (list(, $master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
  103.                             $all_tables[] = $master_table;
  104.                         }
  105.  
  106.                         // then for each master, add its foreigns into an array
  107.                         // of foreign tables, if not already there
  108.                         // (a foreign might be foreign for more than
  109.                         // one table, and might be a master itself)
  110.  
  111.                         $foreign_tables = array();
  112.                         foreach ($all_tables AS $master_table) {
  113.                             $foreigners = PMA_getForeigners($db, $master_table);
  114.                             foreach ($foreigners AS $foreigner) {
  115.                                 if (!in_array($foreigner['foreign_table'], $foreign_tables)) {
  116.                                     $foreign_tables[] = $foreigner['foreign_table'];
  117.                                 }
  118.                             }
  119.                         }
  120.  
  121.                         // then merge the arrays
  122.                         foreach ($foreign_tables AS $foreign_table) {
  123.                             if (!in_array($foreign_table, $all_tables)) {
  124.                                 $all_tables[] = $foreign_table;
  125.                             }
  126.                         }
  127.                         // now generate the coordinates for the schema,
  128.                         // in a clockwise spiral
  129.  
  130.                         $pos_x = 300;
  131.                         $pos_y = 300;
  132.                         $delta = 110;
  133.                         $delta_mult = 1.10;
  134.                         $direction = "right";
  135.                         foreach ($all_tables AS $current_table) {
  136.  
  137.                             // save current table's coordinates
  138.                             $insert_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
  139.                                           . '(db_name, table_name, pdf_page_number, x, y) '
  140.                                           . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pdf_page_number . ',' . $pos_x . ',' . $pos_y . ')';
  141.                             PMA_query_as_cu($insert_query, FALSE, $query_default_option);
  142.  
  143.                             // compute for the next table
  144.                             switch ($direction) {
  145.                                 case 'right':
  146.                                     $pos_x += $delta;
  147.                                     $direction = "down";
  148.                                     $delta *= $delta_mult;
  149.                                     break;
  150.                                 case 'down':
  151.                                     $pos_y += $delta;
  152.                                     $direction = "left";
  153.                                     $delta *= $delta_mult;
  154.                                     break;
  155.                                 case 'left':
  156.                                     $pos_x -= $delta;
  157.                                     $direction = "up";
  158.                                     $delta *= $delta_mult;
  159.                                     break;
  160.                                 case 'up':
  161.                                     $pos_y -= $delta;
  162.                                     $direction = "right";
  163.                                     $delta *= $delta_mult;
  164.                                     break;
  165.                             } // end switch
  166.                         } // end while
  167.                     } // end if there are master tables
  168.  
  169.                     $chpage = $pdf_page_number;
  170.                 } // end if isset autolayout
  171.  
  172.                 break;
  173.  
  174.             case 'edcoord':
  175.                 for ($i = 0; $i < $c_table_rows; $i++) {
  176.                     $arrvalue = 'c_table_' . $i;
  177.                     $arrvalue = $$arrvalue;
  178.                     if (!isset($arrvalue['x']) || $arrvalue['x'] == '') {
  179.                         $arrvalue['x'] = 0;
  180.                     }
  181.                     if (!isset($arrvalue['y']) || $arrvalue['y'] == '') {
  182.                         $arrvalue['y'] = 0;
  183.                     }
  184.                     if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
  185.                         $test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
  186.                                     .   ' WHERE db_name = \'' .  PMA_sqlAddslashes($db) . '\''
  187.                                     .   ' AND   table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
  188.                                     .   ' AND   pdf_page_number = ' . $chpage;
  189.                         $test_rs    = PMA_query_as_cu($test_query, FALSE, $query_default_option);
  190.                         if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
  191.                             if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
  192.                                 $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
  193.                                           .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  194.                                           .   ' AND   table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
  195.                                           .   ' AND   pdf_page_number = ' . $chpage;
  196.                             } else {
  197.                                 $ch_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
  198.                                           . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
  199.                                           .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  200.                                           .   ' AND   table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
  201.                                           .   ' AND   pdf_page_number = ' . $chpage;
  202.                             }
  203.                         } else {
  204.                             $ch_query     = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
  205.                                           . '(db_name, table_name, pdf_page_number, x, y) '
  206.                                           . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
  207.                         }
  208.                         PMA_query_as_cu($ch_query, FALSE, $query_default_option);
  209.                     } // end if
  210.                 } // end for
  211.                 break;
  212.             case 'deleteCrap':
  213.                 foreach ($delrow AS $current_row) {
  214.                     $d_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n"
  215.                              .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n"
  216.                              .   ' AND   table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n"
  217.                              .   ' AND   pdf_page_number = ' . $chpage;
  218.                     PMA_query_as_cu($d_query, FALSE, $query_default_option);
  219.                 }
  220.                 break;
  221.         } // end switch
  222.     } // end if (isset($do))
  223.  
  224.     // We will need an array of all tables in this db
  225.     $selectboxall = array('--');
  226.     $alltab_rs    = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
  227.     while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
  228.         $selectboxall[] = $val[0];
  229.     }
  230.  
  231.     // Now first show some possibility to choose a page for the pdf
  232.     $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
  233.                 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
  234.     $page_rs    = PMA_query_as_cu($page_query, FALSE, $query_default_option);
  235.  
  236.     if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) {
  237.         ?>
  238. <form method="get" action="pdf_pages.php" name="selpage">
  239.     <?php echo $strChoosePage . "\n"; ?>
  240.     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  241.     <input type="hidden" name="do" value="choosepage" />
  242.     <select name="chpage" onchange="this.form.submit()">
  243.         <?php
  244.         while ($curr_page = PMA_DBI_fetch_assoc($page_rs)) {
  245.             echo "\n" . '        '
  246.                  . '<option value="' . $curr_page['page_nr'] . '"';
  247.             if (isset($chpage) && $chpage == $curr_page['page_nr']) {
  248.                 echo ' selected="selected"';
  249.             }
  250.             echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
  251.         } // end while
  252.         echo "\n";
  253.         ?>
  254.     </select>
  255.     <input type="radio" name="action_choose" value="0" id="radio_choose0" checked="checked" style="vertical-align: middle" /><label for="radio_choose0">
  256. <?php echo $strEdit; ?> </label>
  257.     <input type="radio" name="action_choose" value="1" id="radio_choose1"  style="vertical-align: middle" /><label for="radio_choose1">
  258. <?php echo $strDelete; ?> </label>
  259.  
  260.     <input type="submit" value="<?php echo $strGo; ?>" />
  261. </form>
  262.         <?php
  263.     }
  264.     echo "\n";
  265.  
  266.     // Possibility to create a new page:
  267.     ?>
  268. <form method="post" action="pdf_pages.php" name="crpage">
  269.     <?php echo $strCreatePage . "\n"; ?>
  270.     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  271.     <input type="hidden" name="do" value="createpage" />
  272.     <input type="text" name="newpage" size="20" maxlength="50" />
  273.     <input type="checkbox" name="autolayout" />
  274.     <?php echo '(' . $strAutomaticLayout . ')' . "\n"; ?>
  275.     <input type="submit" value="<?php echo $strGo; ?>" />
  276. </form>
  277.     <?php
  278.     // Now if we already have chosen a page number then we should show the
  279.     // tables involved
  280.     if (isset($chpage) && $chpage > 0) {
  281.         echo "\n";
  282.         ?>
  283. <hr />
  284.  
  285. <h2><?php echo $strSelectTables ;?></h2>
  286.  
  287. <?php
  288. $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
  289.             . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  290.             . ' AND pdf_page_number = ' . $chpage;
  291. $page_rs    = PMA_query_as_cu($page_query, FALSE, $query_default_option);
  292. $array_sh_page = array();
  293. $draginit = '';
  294. $reset_draginit = '';
  295. $i = 0;
  296. while ($temp_sh_page = @PMA_DBI_fetch_assoc($page_rs)) {
  297.     $array_sh_page[] = $temp_sh_page;
  298. }
  299.  
  300. // garvin: Display WYSIWYG-PDF parts?
  301. if ($cfg['WYSIWYG-PDF']) {
  302.     if (!isset($_POST['with_field_names']) && !isset($_POST['showwysiwyg'])) {
  303.         $with_field_names = TRUE;
  304.     }
  305. ?>
  306. <script type="text/javascript" language="javascript" src="./js/dom-drag.js"></script>
  307. <form method="post" action="pdf_pages.php" name="dragdrop">
  308. <input type="button" name="dragdrop" value="<?php echo $strToggleScratchboard; ?>" onclick="ToggleDragDrop('pdflayout');" />
  309.  <input type="button" name="dragdropreset" value="<?php echo $strReset; ?>" onclick="resetDrag();" />
  310. </form>
  311. <div id="pdflayout" class="pdflayout" style="visibility: hidden;">
  312. <?php
  313. foreach ($array_sh_page AS $key => $temp_sh_page) {
  314.     $drag_x = $temp_sh_page['x'];
  315.     $drag_y = $temp_sh_page['y'];
  316.  
  317.     $draginit       .= '    Drag.init(getElement("table_' . $i . '"), null, 0, parseInt(myid.style.width)-2, 0, parseInt(myid.style.height)-5);' . "\n";
  318.     $draginit       .= '    getElement("table_' . $i . '").onDrag = function (x, y) { document.edcoord.elements["c_table_' . $i . '[x]"].value = parseInt(x); document.edcoord.elements["c_table_' . $i . '[y]"].value = parseInt(y) }' . "\n";
  319.     $draginit       .= '    getElement("table_' . $i . '").style.left = "' . $drag_x . 'px";' . "\n";
  320.     $draginit       .= '    getElement("table_' . $i . '").style.top  = "' . $drag_y . 'px";' . "\n";
  321.     $reset_draginit .= '    getElement("table_' . $i . '").style.left = "2px";' . "\n";
  322.     $reset_draginit .= '    getElement("table_' . $i . '").style.top  = "' . (15 * $i) . 'px";' . "\n";
  323.     $reset_draginit .= '    document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
  324.     $reset_draginit .= '    document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
  325.  
  326.     $local_query = 'SHOW FIELDS FROM '
  327.                  .  PMA_backquote($temp_sh_page['table_name'] )
  328.                 . ' FROM ' . PMA_backquote($db);
  329.     $fields_rs = PMA_DBI_query($local_query);
  330.     unset($local_query);
  331.     $fields_cnt = PMA_DBI_num_rows($fields_rs);
  332.  
  333.     echo '<div id="table_' . $i . '" class="pdflayout_table"><u>' . $temp_sh_page['table_name'] . '</u>';
  334.     if (isset($with_field_names)) {
  335.         while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
  336.             echo '<br />' . htmlspecialchars($row['Field']) . "\n";
  337.         }
  338.     }
  339.     echo '</div>' . "\n";
  340.     PMA_DBI_free_result($fields_rs);
  341.     unset($fields_rs);
  342.  
  343.     $i++;
  344. }
  345. ?>
  346. </div>
  347. <script type="text/javascript" language="javascript">
  348. //<![CDATA[
  349. function init() {
  350.     refreshLayout();
  351.     myid = getElement('pdflayout');
  352.     <?php echo $draginit; ?>
  353. }
  354.  
  355. function resetDrag() {
  356.     <?php echo $reset_draginit; ?>
  357. }
  358. //]]>
  359. </script>
  360. <?php
  361. } // end if WYSIWYG-PDF
  362. ?>
  363.  
  364. <form method="post" action="pdf_pages.php" name="edcoord">
  365.     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  366.     <input type="hidden" name="chpage" value="<?php echo $chpage; ?>" />
  367.     <input type="hidden" name="do" value="edcoord" />
  368.     <table border="0">
  369.     <tr>
  370.         <th><?php echo $strTable; ?></th>
  371.         <th><?php echo $strDelete; ?></th>
  372.         <th>X</th>
  373.         <th>Y</th>
  374.     </tr>
  375.         <?php
  376.         if (isset($ctable)) {
  377.             unset($ctable);
  378.         }
  379.  
  380.  
  381.         $i = 0;
  382.         foreach ($array_sh_page AS $dummy_sh_page => $sh_page) {
  383.             $_mtab       = $sh_page['table_name'];
  384.             $tabExist[$_mtab] = FALSE;
  385.             echo "\n" . '    <tr ';
  386.             if ($i % 2 == 0) {
  387.                 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
  388.             } else {
  389.                 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
  390.             }
  391.             echo '>';
  392.             echo "\n" . '        <td>'
  393.                  . "\n" . '            <select name="c_table_' . $i . '[name]">';
  394.             foreach ($selectboxall AS $key => $value) {
  395.                 echo "\n" . '                <option value="' . $value . '"';
  396.                 if ($value == $sh_page['table_name']) {
  397.                     echo ' selected="selected"';
  398.                     $tabExist[$_mtab] = TRUE;
  399.                 }
  400.                 echo '>' . $value . '</option>';
  401.             } // end while
  402.             echo "\n" . '            </select>'
  403.                  . "\n" . '        </td>';
  404.             echo "\n" . '        <td>'
  405.                  . "\n" . '            <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
  406.             echo "\n" . '        </td>';
  407.             echo "\n" . '        <td>'
  408.                  . "\n" . '            <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'x\', this.value)"' : '') . ' name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
  409.             echo "\n" . '        </td>';
  410.             echo "\n" . '        <td>'
  411.                  . "\n" . '            <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'y\', this.value)"' : '') . ' name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
  412.             echo "\n" . '        </td>';
  413.             echo "\n" . '    </tr>';
  414.             $i++;
  415.         } // end while
  416.         // Do one more empty row
  417.         echo "\n" . '    <tr ';
  418.         if ($i % 2 == 0) {
  419.             echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
  420.         } else {
  421.             echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
  422.         }
  423.         echo '>';
  424.         echo "\n" . '        <td>'
  425.              . "\n" . '            <select name="c_table_' . $i . '[name]">';
  426.         foreach ($selectboxall AS $key => $value) {
  427.             echo "\n" . '                <option value="' . $value . '">' . $value . '</option>';
  428.         }
  429.         echo "\n" . '            </select>'
  430.              . "\n" . '        </td>';
  431.         echo "\n" . '        <td>'
  432.              . "\n" . '            <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
  433.         echo "\n" . '        </td>';
  434.         echo "\n" . '        <td>'
  435.              . "\n" . '            <input type="text" name="c_table_' . $i . '[x]" value="' . (isset($sh_page['x'])?$sh_page['x']:'') . '" />';
  436.         echo "\n" . '        </td>';
  437.         echo "\n" . '        <td>'
  438.              . "\n" . '            <input type="text" name="c_table_' . $i . '[y]" value="' . (isset($sh_page['y'])?$sh_page['y']:'') . '" />';
  439.         echo "\n" . '        </td>';
  440.         echo "\n" . '    </tr>';
  441.         echo "\n" . '    </table>' . "\n";
  442.  
  443.         echo "\n" . '    <input type="hidden" name="c_table_rows" value="' . ($i + 1) . '" />';
  444.         echo ($cfg['WYSIWYG-PDF'] ? "\n" . '    <input type="hidden" name="showwysiwyg" value="' . ((isset($showwysiwyg) && $showwysiwyg == '1') ? '1' : '0') . '" />' : '');
  445.         echo "\n" . '    <input type="checkbox" name="with_field_names" ' . (isset($with_field_names) ? 'checked="checked"' : ''). ' />' . $strColumnNames . '<br />';
  446.         echo "\n" . '    <input type="submit" value="' . $strSave . '" />';
  447.         echo "\n" . '</form>' . "\n\n";
  448.     } // end if
  449.  
  450.     //  Check if there are tables that need to be deleted,
  451.     //  if there are, ask the user for allowance
  452.     $_strtrans  = '';
  453.     $_strname   = '';
  454.     $shoot      = FALSE;
  455.     if (!empty($tabExist) && is_array($tabExist)) {
  456.         foreach ($tabExist AS $key => $value) {
  457.             if (!$value) {
  458.                 $_strtrans  .= '<input type="hidden" name="delrow[]" value="' . $key . '" />' . "\n";
  459.                 $_strname   .= '<li>' . $key . '</li>' . "\n";
  460.                 $shoot       = TRUE;
  461.             }
  462.         }
  463.         if ($shoot) {
  464.             echo '<form action="pdf_pages.php" method="post">' . "\n"
  465.                . PMA_generate_common_hidden_inputs($db, $table)
  466.                . '<input type="hidden" name="do" value="deleteCrap" />' . "\n"
  467.                . '<input type="hidden" name="chpage" value="' . $chpage . '" />' . "\n"
  468.                . $strDelOld
  469.                . '<ul>' . "\n"
  470.                . $_strname
  471.                . '</ul>' . "\n"
  472.                . $_strtrans
  473.                . '<input type="submit" value="' . $strGo . '" />' . "\n"
  474.                . '</form>';
  475.         }
  476.     }
  477.     //    ------------------------------------
  478.     //    d i s p l a y   p d f    s c h e m a
  479.     //    ------------------------------------
  480.  
  481.     if (isset($do)
  482.     && ($do == 'edcoord'
  483.        || ($do == 'choosepage' && isset($chpage))
  484.        || ($do == 'createpage' && isset($chpage)))) {
  485.         ?>
  486. <form method="post" action="pdf_schema.php" name="pdfoptions">
  487.     <?php echo PMA_generate_common_hidden_inputs($db); ?>
  488.     <input type="hidden" name="pdf_page_number" value="<?php echo $chpage; ?>" />
  489.  
  490.     <?php echo '<br /><b>' . $strDisplayPDF . '</b>'; ?>: <br />
  491.     <input type="checkbox" name="show_grid" id="show_grid_opt" /><label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
  492.     <input type="checkbox" name="show_color" id="show_color_opt" checked="checked" /><label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
  493.     <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" /><label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label><br />
  494.     <input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" /><label for="all_tab_same_wide"><?php echo $strAllTableSameWidth; ?></label><br />
  495.     <input type="checkbox" name="with_doc" id="with_doc" checked="checked" /><label for="with_doc"><?php echo $strDataDict; ?></label>
  496.     <br />
  497.     <label for="orientation_opt"><?php echo $strShowDatadictAs; ?></label>
  498.     <select id="orientation_opt" name="orientation" <?php echo ($cfg['WYSIWYG-PDF'] ? 'onchange="refreshDragOption(\'pdflayout\');"' : ''); ?>>
  499.         <option value="L"><?php echo $strLandscape;?></option>
  500.         <option value="P"><?php echo $strPortrait;?></option>
  501.     </select><br />
  502.  
  503.     <label for="paper_opt"><?php echo $strPaperSize; ?></label>
  504.     <select id="paper_opt" name="paper" <?php echo ($cfg['WYSIWYG-PDF'] ? 'onchange="refreshDragOption(\'pdflayout\');"' : ''); ?>>
  505. <?php
  506.         foreach ($cfg['PDFPageSizes'] AS $key => $val) {
  507.             echo '<option value="' . $val . '"';
  508.             if ($val == $cfg['PDFDefaultPageSize']) {
  509.                 echo ' selected="selected"';
  510.             }
  511.             echo ' >' . $val . '</option>' . "\n";
  512.         }
  513. ?>
  514.     </select><br />
  515.       <input type="submit" value="<?php echo $strGo; ?>" />
  516. </form>
  517. <?php
  518.         if ((isset($showwysiwyg) && $showwysiwyg == '1')) {
  519. ?>
  520. <script type="text/javascript" language="javascript">
  521. //<![CDATA[
  522. ToggleDragDrop('pdflayout');
  523. //]]>
  524. </script>
  525. <?php
  526.         }
  527.     } // end if
  528. } // end if ($cfgRelation['pdfwork'])
  529.  
  530.  
  531. /**
  532.  * Displays the footer
  533.  */
  534. echo "\n";
  535. require_once('./libraries/footer.inc.php');
  536. ?>
  537.